// f(1) = 1
// f(2) = 1
// f(n) = f(n-2) + f(n - 1)
// fabonacci[] = [f(1), f(2), ...f(n)]
function findIndexInFibonacciList(num) {
    let n1 = 1;
    let n2 = 1;
    let arr = [1, 1] // fabo
    let j = 3; // 计数器 第j个
    if (num == 2) return 2
    for (let i = 2; i <= num; i++) {
        // i 不是 fabo
        if (i = n1 + n2) { // 是
            arr.push(i);
            // 动态更新n1 n2
            n1 = arr[j - 2];
            n2 = arr[j - 1];
            j++;
        }
    }
    return arr.indexOf(num)
}

console.log(findIndexInFibonacciList(8))